
<label class="title label-white-1">3. Chọn số và đánh</label>

<div class="content">
    <div id="tabChonsode">

        <ul class="tab clear">
            <?php
            foreach ($result as $rs) {
                $SubThreadRuleID = $rs['SubThreadRuleID'];
                $Name = $rs['Name'];
                ?>
                <li data-tab="<?php echo $SubThreadRuleID; ?>">
                    <a><?php echo $Name; ?></a>
                </li>
                <?php
            }
            ?>
        </ul>
        <script>
            $('#tabChonsode ul.tab > li:eq(0)').addClass('actived');
        </script>

        <ul class="content">
            <?php
            foreach ($result as $rs) {
                $ThreadID = $rs['ThreadID'];
                $SubThreadRuleID = $rs['SubThreadRuleID'];
                $Name = $rs['Name'];
                $RegionName = $rs['RegionName'];
                $MinMoneyBet = $rs['MinMoneyBet'];
                $NoNumber = $rs['NoNumber'];
                $NoAllow = $rs['NoAllow'];
                $DescriptionRule = $rs['DescriptionRule'];
                ?>
                <li data-tab="<?php echo $SubThreadRuleID; ?>">

                    <ul class="tab-sp clear" data-no="<?php echo $NoNumber; ?>">
                        <?php
                        if ($NoNumber == 1) {
                            ?>
                            <li data-tab="1" data-no-left="0" data-no-right="9"></li>
                            <?php
                        } else if ($NoNumber == 2) {
                            ?>
                            <li data-tab="1" data-no-left="00" data-no-right="99"></li>
                            <?php
                        } else if ($NoNumber == 3) {
                            ?>
                            <li data-tab="1" data-no-left="000" data-no-right="099"></li>
                            <li data-tab="2" data-no-left="100" data-no-right="199"></li>
                            <li data-tab="3" data-no-left="200" data-no-right="299"></li>
                            <li data-tab="4" data-no-left="300" data-no-right="399"></li>
                            <li data-tab="5" data-no-left="400" data-no-right="499"></li>
                            <li data-tab="6" data-no-left="500" data-no-right="599"></li>
                            <li data-tab="7" data-no-left="600" data-no-right="699"></li>
                            <li data-tab="8" data-no-left="700" data-no-right="799"></li>
                            <li data-tab="9" data-no-left="800" data-no-right="899"></li>
                            <li data-tab="10" data-no-left="900" data-no-right="999"></li>
                            <?php
                        } else if ($NoNumber == 4) {
                            ?>
                            <li data-tab="1" data-no-left="0000" data-no-right="9999"></li>
                            <?php
                        }
                        ?>
                    </ul>
                    <script>
                        $('#tabChonsode ul.tab-sp').each(function() {
                            $(this).find(' > li:eq(0)').addClass('actived');
                        });
                    </script>

                    <ul class="content-sp" data-thread="<?php echo $ThreadID ?>" data-noallow="<?php echo $NoAllow ?>" data-no="<?php echo $NoNumber; ?>">
                        <?php
                        if ($NoNumber == 1) {
                            ?>
                            <li data-tab="1" data-subthreadrule="<?php echo $SubThreadRuleID; ?>">
                                <div class="number-checkedgroup clear">
                                    <?php
                                    for ($i = 0; $i < 10; $i++) {
                                        ?>
                                        <span class="checkbox">
                                            <input type="checkbox" name="numberBet" value="<?php echo $i ?>" /><?php echo $i; ?>
                                        </span>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </li>
                            <?php
                        } else if ($NoNumber == 2) {
                            ?>
                            <li data-tab="1" data-subthreadrule="<?php echo $SubThreadRuleID; ?>">
                                <div class="number-checkedgroup clear">
                                    <?php
                                    for ($i = 0; $i < 100; $i++) {
                                        ?>
                                        <span class="checkbox">
                                            <input type="checkbox" name="numberBet" value="<?php echo $functions->numToString($i, 2); ?>" /><?php echo $functions->numToString($i, 2); ?>
                                        </span>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </li>
                            <?php
                        } else if ($NoNumber == 3) {
                            $NumStart = 0;
                            $NumEnd = $NumStart + 100;
                            for ($i = 0; $i < 10; $i++) {
                                ?>
                                <li data-tab="<?php echo ($i + 1); ?>" data-subthreadrule="<?php echo $SubThreadRuleID; ?>">
                                    <div class="number-checkedgroup clear">
                                        <?php
                                        for ($j = $NumStart; $j < $NumEnd; $j++) {
                                            ?>
                                            <span class="checkbox">
                                                <input type="checkbox" name="numberBet" value="<?php echo $functions->numToString($j, 3); ?>" /><?php echo $functions->numToString($j, 3); ?>
                                            </span>
                                            <?php
                                        }
                                        $NumStart = $NumEnd;
                                        $NumEnd = $NumStart + 100;
                                        ?>
                                    </div>
                                </li>
                                <?php
                            }
                        } else if ($NoNumber == 4) {
                            ?>
                            <li data-tab="1" data-subthreadrule="<?php echo $SubThreadRuleID; ?>">
                                <div class="selectedbox" id="betNoNum4">
                                    <select id="" name="numberBet1">
                                        <?php
                                        for ($i = 0; $i < 10; $i++) {
                                            ?>
                                            <option type="checkbox" value="<?php echo $i ?>"><?php echo $i; ?></option>
                                            <?php
                                        }
                                        ?>
                                    </select>
                                </div>
                                <div class="selectedbox" id="betNoNum4">
                                    <select id="" name="numberBet2">
                                        <?php
                                        for ($i = 0; $i < 10; $i++) {
                                            ?>
                                            <option type="checkbox" value="<?php echo $i ?>"><?php echo $i; ?></option>
                                            <?php
                                        }
                                        ?>
                                    </select>
                                </div>
                                <div class="selectedbox" id="betNoNum4">
                                    <select id="" name="numberBet3">
                                        <?php
                                        for ($i = 0; $i < 10; $i++) {
                                            ?>
                                            <option type="checkbox" value="<?php echo $i ?>"><?php echo $i; ?></option>
                                            <?php
                                        }
                                        ?>
                                    </select>
                                </div>
                                <div class="selectedbox" id="betNoNum4">
                                    <select id="" name="numberBet4">
                                        <?php
                                        for ($i = 0; $i < 10; $i++) {
                                            ?>
                                            <option type="checkbox" value="<?php echo $i ?>"><?php echo $i; ?></option>
                                            <?php
                                        }
                                        ?>
                                    </select>
                                </div>
                            </li>
                            <?php
                        }
                        ?>
                    </ul>
                    <script>
                        handleSelectedBox();
                        $('#danhDe input[name="betMoney"]').ForceNumericOnly();
                        $('#tabChonsode ul.content-sp').each(function() {
                            $(this).find(' > li:eq(0)').addClass('actived');
                        });
                    </script>

                    <div id="betSode">
                        <div>
                            <input type="text" name="betMoney" value="" />
                            <span class="zero">.000 </span><span class="tiente">VNĐ </span>
                            <input class="button-red-1" type="button" name="submit" value="Đánh" />
                        </div>
                        <div class="note">
                            Số tiền đặt cược áp dụng cho mỗi số được chọn, tiền cược tối thiểu là <?php echo number_format($MinMoneyBet, "0", ",", "."); ?> vnđ
                        </div>
                    </div>

                    <div id="rulePlaySode">
                        <h2 class="label-blue-1">Luật chơi <?php echo $Name; ?> miền <?php echo $RegionName; ?></h2>
                        <p class="description">
                            <?php echo $DescriptionRule; ?>
                        </p>
                    </div>

                </li>
                <?php
            }
            ?>
        </ul>
        <script>
            $('#tabChonsode ul.content > li:eq(0)').addClass('actived');
        </script>

    </div>
</div>